package bitekeji.day2.write;

import java.io.*;

public class WriteText {
    public static void main(String[] args) throws IOException {
        try (OutputStream os = new FileOutputStream("world2.txt")) {
            try (Writer writer = new OutputStreamWriter(os, "UTF-8")) {
                try (PrintWriter printWriter = new PrintWriter(writer)) {

                    printWriter.println("你好世界");
                    printWriter.print("中国");
                    printWriter.printf("%s %d\r\n", "走起来", 123);

                    printWriter.flush();
                }
            }
        }
    }
}
